package com.mbc.rmt.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import com.mbc.common.dao.DAO;
import com.mbc.rmt.entities.CashReceivedSerial;

public class CashReceivedSerialDAOImpls extends DAO<CashReceivedSerial> implements CashReceivedSerialDAO {

	public CashReceivedSerialDAOImpls(Connection conn){
		this.conn = conn;
	} 
	
	@Override
	public String getSerialNumber(long branchId, Date rmtDate) throws SQLException {
		query = "exec sp_rmt_cash_received_serial @param1=?,@param2=?;";
		pstmt = conn.prepareStatement(query);
		pstmt.setLong(1, branchId);
		pstmt.setDate(2, new java.sql.Date(rmtDate.getTime()));
		rs = pstmt.executeQuery();
		rs.next();
		String l_receiptNo = rs.getString(1);
		pstmt.close();
		return l_receiptNo;
	}

	@Override
	protected CashReceivedSerial readRecord(ResultSet rs) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}
	
}
